package com.dotflat.physicalevaluate.domain.pe;

import com.matt.commons.model.Domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 测量标准
 */
@Data
@Entity
@Table(name = "pe_rel_measure_record", uniqueConstraints = {@UniqueConstraint(columnNames = {"recordId", "measureId"})})
@JsonIgnoreProperties(value = { "record"})
@EqualsAndHashCode(callSuper = false)
public class RelRecordMeasure extends Domain implements Serializable {

    @Column(length = 32)
    private String measureId;

//    @OneToOne
//    @JoinColumn(name = "measureId", columnDefinition = " varchar(32) COMMENT '测量值 id' ")
//    private Measure measure;

    @ManyToOne
    @JoinColumn(name = "recordId", columnDefinition = " varchar(32) COMMENT '导入记录 id' ")
    @JsonIgnore
    private PERecord record;


    @Column(columnDefinition = " varchar(20) COMMENT '测量值' ")
    private String measureValue;

    @Column(name = "unit",columnDefinition = "varchar(10) DEFAULT 0 COMMENT '单位'", nullable = false)
    private String unit;

    @Column(name = "rankStr", nullable = false)
    private String rankStr;

    @Column(name = "rankVal", columnDefinition = "INT DEFAULT 0 COMMENT '得分'", nullable = false)
    private Integer rankVal;

    @Column(columnDefinition = "int default 0 COMMENT '顺序'")
    private Integer seq;

    @Column(columnDefinition = "varchar(50) COMMENT '维度'")
    private String dimension;

    @Column(columnDefinition = "varchar(50) COMMENT '测查项目'")
    private String project;

    @Transient
    private Measure measure;

    @Transient
    private Dimension dim;
}